local sk__fangxin = fk.CreateSkill {

  name = "sk__fangxin",

  tags = {  },

}



sk__fangxin:addEffect("viewas", {
  name = "sk__fangxin",
  anim_type = "support",
  pattern = "peach",
  prompt = "#sk__fangxin",
  card_filter = function(self, player, to_select, selected)
    if #selected == 0 then
      if Fk:getCardById(to_select).suit == Card.Diamond then
        return not player:hasDelayedTrick("indulgence")
      end
      if Fk:getCardById(to_select).suit == Card.Club then
        return not player:hasDelayedTrick("supply_shortage")
      end
    end
  end,
  view_as = function(self, player,cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard("peach")
    card.skillName = sk__fangxin.name
    card:setMark(sk__fangxin.name, cards[1])
    return card
  end,
  before_use = function (self, player, use)
    local card
    if Fk:getCardById(use.card:getMark(sk__fangxin.name)).suit == Card.Diamond then
      card = Fk:cloneCard("indulgence")
    end
    if Fk:getCardById(use.card:getMark(sk__fangxin.name)).suit == Card.Club then
      card = Fk:cloneCard("supply_shortage")
    end
    card:addSubcards({use.card:getMark(sk__fangxin.name)})
    card.skillName = sk__fangxin.name
    player:addVirtualEquip(card)
    player.room:moveCardTo(card, Player.Judge, player, fk.ReasonJustMove, sk__fangxin.name, nil, true, player)
  end,
  enabled_at_play  = function (self, player)
    return not table.contains(player.sealedSlots, Player.JudgeSlot) and
      not (player:hasDelayedTrick("indulgence") and player:hasDelayedTrick("supply_shortage"))
  end,
  enabled_at_response = function(self, player, response)
    return not response and not table.contains(player.sealedSlots, Player.JudgeSlot) and
      not (player:hasDelayedTrick("indulgence") and player:hasDelayedTrick("supply_shortage"))
  end,
})

return sk__fangxin